package com.dgshanger.sanhxiaofeisc.mvp.model

import com.dgshanger.sanhxiaofeisc.common.AppApi
import com.dgshanger.sanhxiaofeisc.entity.CodePaySettingEntity
import com.dgshanger.sanhxiaofeisc.mvp.contract.CodePaySettingContract
import com.xx.baseutilslibrary.network.rx.RxHelper
import com.xx.baseutilslibrary.network.rx.XxBaseHttpObserver


/**
 * Created by JacobHHH on 2018/4/20.
 */
class CodePaySettingModel : CodePaySettingContract.Model {

    override fun saveCodePaySettingStatus(pay_set_type: String?, pay_set_wallet_rate: String?
                                          , pay_set_integral_rate: String?, httpObserver: XxBaseHttpObserver<Any>?) {
        AppApi.Api().saveCodePaySettingStatus(pay_set_type,pay_set_wallet_rate,pay_set_integral_rate)
                .compose(RxHelper.io_main())
                .compose(RxHelper.start_finish(httpObserver))
                .subscribe(httpObserver)
    }

    override fun loadData(httpObserver: XxBaseHttpObserver<CodePaySettingEntity>?) {
        AppApi.Api().codePaySettingStatus
                .compose(RxHelper.io_main())
                .compose(RxHelper.start_finish(httpObserver))
                .subscribe(httpObserver)
    }
}